/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package slisfx;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

/**
 *
 * @author ITC
 */
public class WriteToFile {
    
    public void writeToFile(){
    try{
 
    	    String content = "This is the content to write into file";
 
    	    File file =new File("TestDocument.txt");
 
    	    //if file doesnt exists, then create it
    	    if(!file.exists()){
    		file.createNewFile();
    	    }
 
    	    FileWriter fw = new FileWriter(file.getName());
    	    BufferedWriter bw = new BufferedWriter(fw);
    	    bw.write(content);
    	    bw.close();
 
	    System.out.println("Done");
 
    	}catch(IOException e){
    		e.printStackTrace();
    	}
  
    }
}